package main

import "fmt"

func main() {

	// 单向只写
	var chan1 chan<- int
	chan1 <- 1
	// fmt.Println(<-chan1) // invalid operation: cannot receive from send-only channel chan1

	// 单向只读
	var chan2 <-chan int
	// chan2 <- 1 // invalid operation: cannot send to receive-only channel chan2 (variable of type <-chan int)
	fmt.Println(<-chan2) // 此处错误 ,仅为 chan2 un used 报红填写
}
